package com.hllxd.hism.star.basic.service.controller;


import com.hllxd.hism.star.basic.service.service.ResourceBudgetService;
import com.hllxd.hism.star.basic.service.util.ResultUtils;
import com.hllxd.hism.star.basic.service.util.Utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 对外api统一controller
 */
@RestController
@RequestMapping("/basic/v1/api")
@Slf4j
public class ApiController {

    @Autowired
    private ResourceBudgetService resourceBudgetService;

    @RequestMapping(value = "/updateBudgetStatus", method = RequestMethod.GET)
    public Object addEvent(@RequestParam("order_id") String order_id, @RequestParam("applyStatus") Integer applyStatus) {
        try {
            Integer id = resourceBudgetService.updateBudgetStatus(order_id, applyStatus);
            return ResultUtils.result(id);
        } catch (Exception e) {
            log.error("[{}] exception: {}.", Utils.getTraceID(), e, e);
            return ResultUtils.errorResult("-1", "状态更新异常：" + e);
        }
    }
}
